import { _decorator, Camera, Canvas, Component, director, Node, Prefab } from 'cc';
import { app } from '../XForge';
const { ccclass, property } = _decorator;

@ccclass('BaseAdmin')
export default abstract class BaseMain extends Component {
    @property(Prefab)
    private UILoading: Prefab = null;
    @property(Prefab)
    private UIShadow: Prefab = null;
    @property(Prefab)
    private UIToast: Prefab = null;
    @property(Node)
    private UserInterface: Node = null;

    /**
     * 初始化
     */
    protected setup() {
        director.addPersistRootNode(this.node);

        // 初始化全局配置
        app.configuration.Camera = this.UserInterface.getComponent(Camera);
        app.configuration.Canvas = this.getComponent(Canvas);
        app.configuration.UserInterface = this.UserInterface;
        app.configuration.UILoading = this.UILoading;
        app.configuration.UIShadow = this.UIShadow;
        app.configuration.UIToast = this.UIToast;
    }
}